\documentclass{article}
\usepackage{geometry}
\geometry{margin=1.5cm, vmargin={0pt,1cm}}
\setlength{\topmargin}{-1cm}
\setlength{\paperheight}{29.7cm}
\setlength{\textheight}{25.3cm}

% useful packages.
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{enumerate}
\usepackage{graphicx}
\usepackage{multicol}
\usepackage{fancyhdr}
\usepackage{layout}
% \usepackage{ctex}
\usepackage{listings}
\usepackage{subfigure}
\usepackage{setspace}

% some common command
\newcommand{\dif}{\mathrm{d}}
\newcommand{\avg}[1]{\left\langle #1 \right\rangle}
\newcommand{\difFrac}[2]{\frac{\dif #1}{\dif #2}}
\newcommand{\pdfFrac}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\OFL}{\mathrm{OFL}}
\newcommand{\UFL}{\mathrm{UFL}}
\newcommand{\fl}{\mathrm{fl}}
\newcommand{\op}{\odot}
\newcommand{\Eabs}{E_{\mathrm{abs}}}
\newcommand{\Erel}{E_{\mathrm{rel}}}
\newcommand{\RNum}[1]{\uppercase\expandafter{\romannumeral #1\relax}}

\usepackage{xcolor}
\usepackage{fontspec} 
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{comment}{rgb}{0.56,0.64,0.68}

\newfontfamily\monaco{Monaco}
\lstset {
aboveskip=3mm,
belowskip=3mm,
showstringspaces=false,       % underline spaces within strings
columns=flexible,
framerule=1pt,
rulecolor=\color{gray!35},
backgroundcolor=\color{gray!5},
basicstyle={\small\monaco},           % the size of the fonts that are used for the code
numbers=left,                   % where to put the line-numbers
numberstyle=\tiny\monaco\color{gray},  % the style that is used for the line-numbers
numbersep=5pt,                  % how far the line-numbers are from the code
commentstyle=\color{comment},
keywordstyle=\color{blue},
stringstyle=\color{dkgreen},
tabsize=2,                      % sets default tabsize to 2 spaces
captionpos=b,                   % sets the caption-position to bottom
breaklines=true,                % sets automatic line breaking
breakatwhitespace=false,        % sets if automatic breaks should only happen at whitespace
escapeinside={\%*}{*)},            % if add LaTeX within your code
morekeywords={*,...}               % if add more keywords to the set
}


\begin{document}
\title{Finite Difference Method for Possion Equation on Irregular
Domains}
\pagestyle{fancy}
\lhead{Name Li HuiTeng 3180102114}
\rhead{Date 22.03.22}

\section{C++ programming}
\subsection{\textbf{Structure of codes}}
$\textbf{doc}$ stores document;\\
$\textbf{include}$ stores sources files;\\
$\textbf{main}$ stores files concerning the assignments;\\
$\textbf{output}$ stores all results such as $\textbf{*.m}$ and $\textbf{*.png}$.\\
$\textbf{test}$ stores test files.\\
Use $ \textbf{make run} $ to generate answers.
\subsection{\textbf{Answers}}
\lstset{language=C++}
\begin{lstlisting}
  ./assignment betaDDDDN.json   expt1DDDD.json   expt1DDNN.json   sincosDDDDN.json expt1DDDDD.json  expt1DDDDN.json  expt1NNNND.json  sincosNNNND.json
  Solving << RectDomainExcludedDisk_(1+x+y)_DDDDN >>, N = 8
  Plot generated.
  Solving << RectDomainExcludedDisk_(1+x+y)_DDDDN >>, N = 16
  Plot generated.
  Solving << RectDomainExcludedDisk_(1+x+y)_DDDDN >>, N = 32
  Plot generated.
  Solving << RectDomainExcludedDisk_(1+x+y)_DDDDN >>, N = 64
  Plot generated.
  Solving << RectDomain_exp(sin(x)+y)_DDDD >>, N = 8
  Plot generated.
  Solving << RectDomain_exp(sin(x)+y)_DDDD >>, N = 16
  Plot generated.
  Solving << RectDomain_exp(sin(x)+y)_DDDD >>, N = 32
  Plot generated.
  Solving << RectDomain_exp(sin(x)+y)_DDDD >>, N = 64
  Plot generated.
  Convergence Table for RectDomain_exp(sin(x)+y)_DDDD
  
         $h$ &       1/64 &       rate &       1/32 &       rate &       1/16 &       rate &        1/8 \\
  $L^\infty$ &   8.62e-06 &       2.00 &   3.45e-05 &       2.00 &   1.38e-04 &       1.96 &   5.37e-04 \\
       $L^1$ &   3.65e-06 &       2.00 &   1.46e-05 &       1.99 &   5.79e-05 &       1.96 &   2.25e-04 \\
       $L^2$ &   4.46e-06 &       2.00 &   1.79e-05 &       2.00 &   7.13e-05 &       1.99 &   2.84e-04 \\
  
  Solving << RectDomain_exp(sin(x)+y)_DDNN >>, N = 8
  Plot generated.
  Solving << RectDomain_exp(sin(x)+y)_DDNN >>, N = 16
  Plot generated.
  Solving << RectDomain_exp(sin(x)+y)_DDNN >>, N = 32
  Plot generated.
  Solving << RectDomain_exp(sin(x)+y)_DDNN >>, N = 64
  Plot generated.
  Convergence Table for RectDomain_exp(sin(x)+y)_DDNN
  
         $h$ &       1/64 &       rate &       1/32 &       rate &       1/16 &       rate &        1/8 \\
  $L^\infty$ &   8.24e-05 &       2.00 &   3.29e-04 &       2.00 &   1.32e-03 &       1.98 &   5.19e-03 \\
       $L^1$ &   1.98e-05 &       2.04 &   8.11e-05 &       2.07 &   3.40e-04 &       2.11 &   1.47e-03 \\
       $L^2$ &   2.77e-05 &       2.03 &   1.13e-04 &       2.05 &   4.70e-04 &       2.10 &   2.01e-03 \\
  
  Solving << RectDomainExcludedDisk_sin(4pix)cos(3piy)_DDDDN >>, N = 8
  Plot generated.
  Solving << RectDomainExcludedDisk_sin(4pix)cos(3piy)_DDDDN >>, N = 16
  Plot generated.
  Solving << RectDomainExcludedDisk_sin(4pix)cos(3piy)_DDDDN >>, N = 32
  Plot generated.
  Solving << RectDomainExcludedDisk_sin(4pix)cos(3piy)_DDDDN >>, N = 64
  Plot generated.
  Convergence Table for RectDomainExcludedDisk_sin(4pix)cos(3piy)_DDDDN
  
         $h$ &       1/64 &       rate &       1/32 &       rate &       1/16 &       rate &        1/8 \\
  $L^\infty$ &   1.29e-02 &       2.30 &   6.34e-02 &       1.47 &   1.75e-01 &       0.76 &   2.97e-01 \\
       $L^1$ &   2.41e-03 &       2.12 &   1.05e-02 &       1.68 &   3.34e-02 &       0.76 &   5.66e-02 \\
       $L^2$ &   3.61e-03 &       2.14 &   1.59e-02 &       1.68 &   5.10e-02 &       0.99 &   1.01e-01 \\
  
  Solving << RectDomainExcludedDisk_exp(sin(x)+y)_DDDDD >>, N = 8
  Plot generated.
  Solving << RectDomainExcludedDisk_exp(sin(x)+y)_DDDDD >>, N = 16
  Plot generated.
  Solving << RectDomainExcludedDisk_exp(sin(x)+y)_DDDDD >>, N = 32
  Plot generated.
  Solving << RectDomainExcludedDisk_exp(sin(x)+y)_DDDDD >>, N = 64
  Plot generated.
  Convergence Table for RectDomainExcludedDisk_exp(sin(x)+y)_DDDDD
  
         $h$ &       1/64 &       rate &       1/32 &       rate &       1/16 &       rate &        1/8 \\
  $L^\infty$ &   7.40e-05 &       2.35 &   3.77e-04 &       1.60 &   1.15e-03 &       1.42 &   3.06e-03 \\
       $L^1$ &   5.33e-06 &       2.72 &   3.52e-05 &       1.96 &   1.37e-04 &       1.42 &   3.67e-04 \\
       $L^2$ &   9.54e-06 &       2.74 &   6.40e-05 &       1.94 &   2.46e-04 &       1.56 &   7.23e-04 \\
  
  Solving << RectDomainExcludedDisk_exp(sin(x)+y)_DDDDN >>, N = 8
  Plot generated.
  Solving << RectDomainExcludedDisk_exp(sin(x)+y)_DDDDN >>, N = 16
  Plot generated.
  Solving << RectDomainExcludedDisk_exp(sin(x)+y)_DDDDN >>, N = 32
  Plot generated.
  Solving << RectDomainExcludedDisk_exp(sin(x)+y)_DDDDN >>, N = 64
  Plot generated.
  Convergence Table for RectDomainExcludedDisk_exp(sin(x)+y)_DDDDN
  
         $h$ &       1/64 &       rate &       1/32 &       rate &       1/16 &       rate &        1/8 \\
  $L^\infty$ &   1.41e-05 &       2.20 &   6.50e-05 &       1.98 &   2.57e-04 &       2.11 &   1.11e-03 \\
       $L^1$ &   1.87e-06 &       2.44 &   1.02e-05 &       0.96 &   1.97e-05 &       3.44 &   2.13e-04 \\
       $L^2$ &   3.21e-06 &       2.38 &   1.67e-05 &       1.28 &   4.06e-05 &       3.19 &   3.71e-04 \\
  
  Solving << RectDomainExcludedDisk_exp(sin(x)+y)_NNNND >>, N = 8
  Plot generated.
  Solving << RectDomainExcludedDisk_exp(sin(x)+y)_NNNND >>, N = 16
  Plot generated.
  Solving << RectDomainExcludedDisk_exp(sin(x)+y)_NNNND >>, N = 32
  Plot generated.
  Solving << RectDomainExcludedDisk_exp(sin(x)+y)_NNNND >>, N = 64
  Plot generated.
  Convergence Table for RectDomainExcludedDisk_exp(sin(x)+y)_NNNND
  
         $h$ &       1/64 &       rate &       1/32 &       rate &       1/16 &       rate &        1/8 \\
  $L^\infty$ &   9.05e-05 &       2.22 &   4.20e-04 &       1.91 &   1.58e-03 &       1.95 &   6.13e-03 \\
       $L^1$ &   2.70e-05 &       2.42 &   1.45e-04 &       2.12 &   6.32e-04 &       2.19 &   2.88e-03 \\
       $L^2$ &   3.67e-05 &       2.36 &   1.89e-04 &       2.05 &   7.82e-04 &       2.13 &   3.43e-03 \\
  
  Solving << RectDomainExcludedDisk_sin(4pix)cos(3piy)_NNNND >>, N = 8
  Plot generated.
  Solving << RectDomainExcludedDisk_sin(4pix)cos(3piy)_NNNND >>, N = 16
  Plot generated.
  Solving << RectDomainExcludedDisk_sin(4pix)cos(3piy)_NNNND >>, N = 32
  Plot generated.
  Solving << RectDomainExcludedDisk_sin(4pix)cos(3piy)_NNNND >>, N = 64
  Plot generated.
  Convergence Table for RectDomainExcludedDisk_sin(4pix)cos(3piy)_NNNND
  
         $h$ &       1/64 &       rate &       1/32 &       rate &       1/16 &       rate &        1/8 \\
  $L^\infty$ &   5.15e-03 &       1.98 &   2.03e-02 &       2.05 &   8.38e-02 &       1.98 &   3.31e-01 \\
       $L^1$ &   9.84e-04 &       2.11 &   4.24e-03 &       2.28 &   2.05e-02 &       2.56 &   1.21e-01 \\
       $L^2$ &   1.38e-03 &       2.10 &   5.90e-03 &       2.24 &   2.79e-02 &       2.43 &   1.51e-01 \\
\end{lstlisting}
It's clear to see our solver is 2rd convergent for all situations that the assignment require.


\end{document}
%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 
